<?php

/**
 * Root route
 */
Route::get('/', function(){ return Redirect::to( 'home' ); } );

/**
 * Home Routes
 */
Route::any( 'home', array( 'uses' => 'PostController@indexPosts' ) );

Route::any( 'home/today', array( 'uses' => 'PostController@todayPosts' ) );

/*Route::any( 'test', array( 'uses' => 'PostController@test' ) );

Route::any( 'test2', array( 'uses' => 'PostController@getPosts' ) );*/

/**
 * Post Routes
 */
Route::any( 'pun/{id}', array( 'uses' => 'PostController@getPostInfo' ) );

/**
 * Comment Routes
 */
Route::post( 'comment/get-answers', array( 'uses' => 'CommentController@getAnswers' ) );

Route::any( 'comment/get-comments', array( 'uses' => 'CommentController@getComments' ) );

/**
 * Users routes
 */
Route::any( 'user/{user_name}', array( 'uses' => 'UserController@showProfile' ) );

/*Route::any( 'users', function(){ return Redirect::to( 'users/login' ); } );

Route::get( 'users/login', function(){ return View::make( 'users.login' ); } );

Route::post( 'users/login', array( 'uses' => 'UserController@login' ) );

Route::any( 'users/logout', array( 'uses' => 'UserController@logout' ) );

Route::get( 'users/password-remind', function(){ return View::make( 'users.password-remind' ); } );

Route::post( 'users/password-remind', array( 'uses' => 'RemindersController@postRemind' ) );

Route::get( 'users/password-reset/{token}', function( $token ){ return View::make( 'users.password-reset' )->with( 'token', $token ); } );

Route::post( 'users/password-reset', array( 'uses' => 'RemindersController@postReset' ) );

Route::get( 'users/new-user', function(){ return View::make( 'users.new' ); } );

Route::post( 'users/new-user', array( 'uses' => 'UserController@newUser' ) );

Route::any( 'users/profile', array( 'before' => 'auth', function(){ 
	return View::make( 'users.profile', array( 'user' => Auth::user() ) ); } 
) );*/

